package o2o.config.thirdpost.dada;

import lombok.Getter;
import lombok.Setter;
import o2o.thridpost.dada.config.DadaConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

/**
 * DadaConfig
 * @author sunyufan deporation@qq.com
 * @date 2021/6/22 18:26
 * @description: config
 */
@Configuration
@Getter
@Setter
public class DadaConfig {

    private String appKey;

    private String appSecret;

    @Value("${dada.config.online}")
    private boolean isOnline;

    @Value("dada.config.onlinehost")
    private String onlineHost;

    @Value("dada.config.onlinesourceid")
    private String onlineSourceId;

    private String host;

    private String sourceId;

    public DadaConfig() {
        this.appKey = DadaConstant.APP_KEY;
        this.appSecret = DadaConstant.APP_SECRET;
        this.host = isOnline ? onlineHost : DadaConstant.QA_HOST;
        this.sourceId = isOnline ? onlineSourceId : DadaConstant.QA_SOURCE_ID;
    }

}
